package com.study.spmongodb.wwj.collections;

import java.util.Random;

/**
 * @author study
 * @version 1.0
 * @date 2020/12/17 9:51
 * https://www.bilibili.com/video/BV1hJ411D7k2 跳表
 */
public class SimpleSkipList {
    private final static byte HEAD_NOE = (byte) -1;
    private final static byte DATA_NODE = (byte) 0;
    private final static byte TAIL_NODE = (byte) 1;
    /**
     * 头
     */
    private Node head;
    /**
     * 尾巴
     */
    private Node tail;
    private int size;
    private int height;
    private Random random;

    public SimpleSkipList() {
        this.head = new Node(null, HEAD_NOE);
        this.tail = new Node(null, TAIL_NODE);
        head.right = tail;
        tail.left = head;
        this.random = new Random(System.currentTimeMillis());
    }

    public Node find(Integer element) {


        return null;
    }

    public boolean isEmpty() {
        return (size() == 0);
    }

    private int size() {
        return size;
    }

    private static class Node {
        private Integer value;
        private Node up, down, left, right;
        private byte bit;

        public Node(Integer value, byte bit) {
            this.value = value;
            this.bit = bit;
        }

        public Node(Integer value) {
            this(value, DATA_NODE);
        }
    }

}
